<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<!--

http://pastebin.com/f4U7ahyy
http://img211.imageshack.us/img211/6408/86712432.jpg

-->
<script>
$(document).ready(function () {
    var fields,
    body,
    href,
    description,
    index,
    index2,
    target,
    common,
    view = '',
    css = '',
    attr,
    result = {inheritsList: [], ownNamespace: {}, name: '', type: '', method: [], field: [], 'class': [], namespace: [], event: [], subobjects: []},
    fieldMap = {method: "Method Summary", field: "Field Summary", 'class':"Class Summary", namespace: "Namespace Summary", event: "Event Summary"},
    fieldRenderOrder = ['class', 'namespace', 'field', 'method', 'event', 'subobjects'];

    // parsing fields
    for (index in fieldMap) {
        if (fieldMap.hasOwnProperty(index)) {
            target = fieldMap[index];
            fields = $('caption:contains("' + target + '")~tbody tr');

            fields.each(function (fieldIndex, field) {
                attr = $(field).find('.attributes').html().replace(/&(lt|gt|nbsp);/g, '').replace(/\s*$/g, '').split(' ');
                field = $(field).find('.nameDescription');
                body = $(field).find('.fixedFont').text().replace(/\n/g, '').replace(/\s/g, '').split('.');
                body = body[body.length - 1];
                href = $(field).find('.fixedFont a').attr('href');
                description = $(field).find('.description').text();

                result[index].push({
                    body: body,
                    href: href,
                    description: description,
                    attr: attr
                });
            });
        }
    }

    // parsing h1
    common = $('h1').text().replace(/\n/g, '').replace(/\s*$/g, '').replace(/^\s*/g, '').split(' ');
    
    if (common[0] == 'Class') { // its class
        result.type = 'class';
        common[1] = common[1].split('.');
        result.name = common[1].pop();

        // looking for inherited props and methods
        target = $('#content .inheritsList');
        if (target.length) {
            // gets inherit sources
            target.find('dt').each(function (index, item) {
                var type;
                if ($(item).text().match(/Fields borrowed from/)) {
                    type = 'field';
                } else if ($(item).text().match(/Events borrowed from/)) {
                    type = 'event';
                } else {
                    type = 'method';
                }
                // options borrowed from class
                item = $(item).find('a');
                $(item).text();
                $(item).attr('href');
                result.inheritsList[index] = {
                    from: $(item).text(),
                    href: $(item).attr('href'),
                    pairs: [],
                    type: type
                };
            });
            result.inheritsList.from = target.find('dt a').text();
            result.inheritsList.href = target.find('dt a').attr('href');
            result.inheritsList.pairs = [];

            // get source options
            target.find('dd').each(function (index, item) {
               $(item).find('a').each(function (i, item) {
                   result.inheritsList[index].pairs.push({
                      body:  $(item).text(),
                      href:  $(item).attr('href')
                   });
               });
            });
        }
    } else if (common[0] == 'Built-In') { // its class
        result.type = 'built-in';
        result.name = common[2];
    } else { // its namespace
        result.type = 'namespace';
        common[1] = common[1].split('.');
        result.name = common[1].pop();
    }

    // searching for subobjects

    $('#index li a:contains("' + result.name + '.")').each(function (index, item) {
        body = $(item).text().replace(/\n/g, '').replace(/\s*$/g, '').replace(/^\s*/g, '').split('.');
        body = body.pop();

        href = $(item).attr('href');
        description = '';
        attr = [];
        result.subobjects.push({
            body: body,
            href: href,
            description: description,
            attr: attr
        });
    });

    // grabbing own namespaece

    if (typeof common[1] !== 'string' && common[1].length) {
        result.ownNamespace.body = common[1].join('.');
        result.ownNamespace.href = $('#index li a:contains("' + result.ownNamespace.body + '")').attr('href');
    }

    // css

    css += '<style>';
    css += '.classIndexTable {border: 1px solid #000; border-top: 0; left: 850px; position: fixed; top: 20px; font-family: "Courier New"}';
    css += '.classIndexTable .caption {border-bottom: 1px solid #000; border-top: 1px solid #000; text-align: center; font-weight: bold}';
    css += 'table.classIndexTable .field {background: #FAF1C3}';
    css += 'table.classIndexTable .event {background: #D6EB9A}';
    css += 'table.classIndexTable .method {background: #BBD9EE}';
    css += 'table.classIndexTable .class, table.classIndexTable .namespace {background: #fff}';
    css += 'table.classIndexTable .subobjects {background: #FFCCFF}';
    css += 'table.classIndexTable .ownnamespace {background: #CCCCFF}';
    css += 'table.classIndexTable .inherit {background: #eee;}';
    css += 'table.classIndexTable .inherit td {border-bottom:0 !important}';
    css += 'table.classIndexTable a {color: #000}';
    css += 'table.classIndexTable td.static {font-style: italic;}';
    css += 'table.classIndexTable tr.event td.item:before { content: "ϟ " }';
    css += 'table.classIndexTable td.item:before { content: "▪ " }';
    css += 'table.classIndexTable td.private:before { content: "▫ " }';
    
    // render
    css += '</style>';
    view += '<table class="classIndexTable" cellspacing="0" cellpadding="5">';

    if (result.type === 'built-in') {
        view += '<tr class="built-in"><td class="caption">Built-In Namespace</td></tr>';
        view += '<tr class="built-in"><td>' + result.name + '</td></tr>';
    }

    for (index = 0; index < fieldRenderOrder.length; index += 1) {
        target = fieldRenderOrder[index];
        if (result[target].length) {
            view += '<tr class="' + target + '"><td class="caption">' + (fieldMap[target] || 'Sub Objects') + '</td></tr>';
            for (index2 = 0; index2 < result[target].length; index2 += 1) {
                view += '<tr class="' + target + '"><td class="item ' + result[target][index2].attr.join(' ') + '" title="' + result[target][index2].description + '"><a href="' + result[target][index2].href + '">' + result[target][index2].body + '</a></td></tr>';
            }
        }
    }
    if (result.inheritsList.length) {
        view += '<tr class="inherit"><td class="caption">Inherit:</td></tr>';
        for (index = 0; index < result.inheritsList.length; index += 1) {
            view += '<tr class="' + result.inheritsList[index].type + '"><td class="caption"><a href="' + result.inheritsList[index].href + '">' + result.inheritsList[index].from + '</a></td></tr>';
            for (index2 = 0; index2 < result.inheritsList[index].pairs.length; index2 += 1) {
                view += '<tr class="' + result.inheritsList[index].type + '"><td class="item"><a href="' + result.inheritsList[index].pairs[index2].href + '">' + result.inheritsList[index].pairs[index2].body + '</a></td></tr>';
            }
        }
    }
    if (result.ownNamespace.body) {
        view += '<tr class="ownnamespace"><td class="caption">Own Namespace</td></tr>';
        view += '<tr class="ownnamespace"><td class="item"><a href="' + result.ownNamespace.href + '">' + result.ownNamespace.body + '</a></td></tr>';
    }
    view += '</table>';
    $('h1').after(css + view);
});
</script>
<div id="header">
</div>